/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dusin.mobile.util;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 
 * @author tengyu
 */
public class UsersConfig {
    Map<String,Map<String,Object>> users;
    private int maxUsers=200; 

    public UsersConfig() {
        users=new ConcurrentHashMap <String,Map<String,Object>>();
    }
    
    public Object getProperty(String loginName,String propertyName){
        Map<String,Object> properties = users.get(loginName);
        if(properties!=null)
            return properties.get(propertyName);
        else
            return null;
    }
    
    public Object setProperty(String loginName,String propertyName,Object propertyValue){
        Map<String,Object> properties = users.get(loginName);
        Object result=null;
        if(properties==null){
            properties = new HashMap<String,Object>();
            users.put(loginName,properties);
        }
        result=properties.put(propertyName, propertyValue);
        return result;
    }
    
}
